package com.example.maillist;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    public MySQLiteOpenHelper(Context context) {
        super(context, "contactdb", null,1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql="create table contacttb(" +
                " _id integer primary key autoincrement," +
                " name varchar(50) not null," +
                " tel varchar(50) not null)";
        db.execSQL(sql);
        sql = "insert into contacttb(name,tel) values('数据','123456')";
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
